srcdir=         @srcdir@
top_srcdir=     @top_srcdir@
top_builddir=   @top_builddir@
VPATH=          @srcdir@

include ${top_builddir}/Mk/autoconf.mk
include ${top_builddir}/Mk/compile.mk
include ${top_builddir}/Mk/subdir.mk

LIBRARY_NAME=	libs3
LIBRARY_OBJS= \
		S3Account.o \
		S3Atomic.o \
		S3AutoreleasePool.o \
		S3Connection.o \
		S3Dict.o \
		S3Error.o \
		S3Lib.o \
		S3List.o \
		S3Request.o \
		S3String.o \
		S3StringBuilder.o \
		base64.o \
		hash.o \
		list.o

HEADERS= \
		$(srcdir)/S3Account.h \
		$(srcdir)/S3AutoreleasePool.h \
		$(srcdir)/S3Connection.h \
		$(srcdir)/S3Dict.h \
		$(srcdir)/S3Error.h \
		$(srcdir)/S3Lib.h \
		$(srcdir)/S3List.h \
		$(srcdir)/S3Request.h \
		$(srcdir)/S3String.h \
		$(srcdir)/S3StringBuilder.h

GEN_SRCS=

TEST_LIB=	libs3-testing.a
TEST_OBJS=

CFLAGS+=	-fPIC $(LIBCURL_CFLAGS) $(XML_CFLAGS) $(OPENSSL_CFLAGS)
LIBS+=		$(LIBCURL_LDFLAGS) $(XML_LDFLAGS) $(OPENSSL_LDFLAGS)

S3LIB_HEADER_DIR=	$(HEADER_INSTALL_DIR)/S3Lib

all:: $(LIBRARY_FILE) $(TEST_LIB)

$(LIBRARY_FILE): $(GEN_SRCS) $(LIBRARY_OBJS)
	$(MAKE_LIBRARY)

$(TEST_LIB): $(GEN_SRCS) $(LIBRARY_OBJS)
	$(AR) -r $@ $(LIBRARY_OBJS)
	$(RANLIB) $@

install:: $(LIBRARY_FILE)
	$(INSTALL_LIBRARY)
	$(INSTALL_DIR) $(S3LIB_HEADER_DIR)
	$(INSTALL_HEADER) $(HEADERS) $(S3LIB_HEADER_DIR)

clean::
	rm -f $(TEST_OBJS) $(LIBRARY_OBJS) $(TEST_LIB) $(GEN_SRCS)
	$(CLEAN_LIBRARY)

distclean:: clean
	rm -f Makefile
